<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of SeoService
 *
 * @author Administrator
 */
class SeoService {

    function insert($seo) {
        $s = $this->findSeoByModule($seo['module']);
        if (!empty($s)) {
            $seo['id'] = $s['id'];
            return $this->update($seo);
        } else {
            return D("seo")->add($seo);
        }
    }

    function findSeoByModule($module) {
        $where['module'] = array('eq', $module);

        return D("seo")->where($where)->find();
    }

    function update($seo) {
        return D("seo")->save($seo);
    }

}

?>
